/********************************************************************************
 * Project Name		[JavaEE_Components]
 * File Name     	[MailAuthenticator.java]
 * Creation Date 	[2015-01-01]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ********************************************************************************/
package javamail.utils;

import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

/**
 * @author 不落的太阳(Sean Yang aka ShortPeace)
 * @version 1.0
 * @since jdk 1.8
 * 
 */
public class MailAuthenticator extends Authenticator {

	private String username;
	private String password;

	/**
	 * 可以只传入username, password由 PasswordUtils 去获取
	 * 
	 * @param username
	 * @param password
	 */
	public MailAuthenticator(String username, String password) {
		this.username = username;
		this.password = password;
	}

	@Override
	public PasswordAuthentication getPasswordAuthentication() {
		return new PasswordAuthentication(username, password);
	}
}
